import { FlatCompat } from "@eslint/eslintrc";
import { dirname } from "path";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const compat = new FlatCompat({
  baseDirectory: __dirname,
});

export default [
  // 继承 Next.js 和 TypeScript 推荐规则
  ...compat.extends("next/core-web-vitals", "plugin:@typescript-eslint/recommended"),
  {
    // 针对 TypeScript 文件
    files: ["**/*.{ts,tsx}"],
    rules: {
      "@typescript-eslint/no-explicit-any": "warns", // 或 "off"，禁用eslink打包校验规则
      "no-console": "warn", // 示例：其他规则
    },
  },
];